package org.southyin.controller;

import org.junit.Test;
import org.southyin.model.Classes;
import org.southyin.model.Stu;
import org.southyin.service.ClassesService;
import org.southyin.service.StuService;
import org.southyin.service.impl.ClassServiceImpl;
import org.southyin.service.impl.StuServiceImpl;

import java.util.Date;
import java.util.List;

public class Main {
    @Test
    public void testAddClass() {
        Classes classes = new Classes();
        classes.setCname("FY21_UI1");
        classes.setCreateTime(new Date());

        ClassesService service = new ClassServiceImpl();
        int num = service.addClasses(classes);

        if (num == 0) {
            System.out.println("新增失败");
        }else{
            System.out.println("新增成功");
        }
    }

    @Test
    public void testFindClassById() {
        ClassesService service = new ClassServiceImpl();
        Classes classes = service.getClassInfoById(9007L);
        System.out.println(classes);
    }

    @Test
    public void testFindClasses() {
        ClassesService service = new ClassServiceImpl();
        List<Classes> list = service.getClasses(null);
        System.out.println(list);
    }

    @Test
    public void deleteTest() {
        ClassesService service = new ClassServiceImpl();
        int num = service.deleteClassById(9005L);
        if (num == 0) {
            System.out.println("删除失败");
        }else{
            System.out.println("删除成功");
        }
    }

    @Test
    public void testFindStuTest() {
        StuService service = new StuServiceImpl();
        List<Stu> stuInfos = service.getStuInfos();
        System.out.println(stuInfos);
    }
}
